<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- designer-manual.qdoc -->
  <title>Editing Resources with Qt Designer | Qt设计师手册</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtdesigner-manual.html">Qt设计师手册</a></td><td >
			使用Qt设计<span lang="zh-cn">师</span>编辑资源</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtdesigner-manual.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="prev" href="designer-creating-mainwindows.html" />
  <link rel="next" href="designer-stylesheet.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="designer-creating-mainwindows.html">在Qt设计师中创建主窗口</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="designer-stylesheet.html"><span lang="zh-cn">在</span>Qt设计<span lang="zh-cn">师中使用样式表</span></a>
</p><p/>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">目录</a></h3>
<ul>
<li class="level1"><a href="#defining-a-resource-file">定义资源文件</a></li>
<li class="level1"><a href="#using-the-resources">使用的资源</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">使用Qt设计<span lang="zh-cn">师</span>编辑资源</h1>
<span class="subtitle"></span>
<!-- $$$designer-resources.html-description -->
<div class="descr"> <a name="details"></a>
<p class="centerAlign"><img src="images/designer-resources-editing.png" alt="" /></p><p>
	Qt Designer完全支持<a href="../qtcore/resources.html">Qt资源系统</a>，使资源可以在设计时与表单一起指定。为了帮助设计人员和开发人员管理应用程序的资源，Qt 
	Designer的资源编辑器允许按表单定义资源。换句话说，每个表单都可以有一个单独的资源文件。</p>
<h2 id="defining-a-resource-file">定义资源文件</h2>
<p>要指定资源文件，必须通过打开“<b>Tools</b> ”菜单并切换“<b>Resource Browser</b>”选项来启用资源编辑器。</p>
<a name="resourcefiles"></a><div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><img src="images/designer-resource-browser.png" alt="" /></td><td >
	 <b>资源文件</b><p>在资源浏览器中，您可以打开现有的资源文件或创建新的资源文件。点击 <b>Edit Resources</b>
	 <span lang="zh-cn">按钮</span><img src="images/designer-edit-resources-button.png" alt="" /> 
	 来编辑您的资源。要重新加载资源，请单击 <b>Reload</b> <span lang="zh-cn">按钮</span><img src="images/designer-reload-resources-button.png" alt="" /> 
	 <span lang="zh-cn">。</span></p>
</td></tr>
</table></div>
<p>一旦资源文件被加载，你可以使用给定的 <b>Add Files</b> <img src="images/designer-add-resource-entry-button.png" alt="" /> 
<span lang="zh-cn">和</span><b>Remove Files</b> <img src="images/designer-remove-resource-entry-button.png" alt="" /> 
<span lang="zh-cn">按钮</span>,<span lang="zh-cn"> </span>创建或删除条目，并使用 <b>Add Files</b>
<span lang="zh-cn">按钮</span><img src="images/designer-add-files-button.png" alt="" /> 
指定资源(例如，图像)。注意，这些资源必须驻留在当前资源文件的目录或它的一个子目录中。</p>
<a name="editresource"></a><div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><img src="images/designer-edit-resource.png" alt="" /></td><td >
	 <b>编辑资源文件</b><p><span lang="zh-cn">按下</span><img src="images/designer-add-resource-entry-button.png" alt="" /> 
	 按钮向文件中添加一个新的资源条目。然后使用 <b>Add Files</b> <span lang="zh-cn">按钮</span> <img src="images/designer-add-files-button.png" alt="" /> 
	 来指定资源。</p>
<p>您可以通过在资源编辑器中选择相应的条目并按 <img src="images/designer-remove-resource-entry-button.png" alt="" /> 
按钮来删除资源。</p>
</td></tr>
</table></div>
<a name="using-the-resources"></a>
<h2 id="using-the-resources">使用的资源</h2>
<p>一旦定义了资源，您就可以在编写表单时主动使用它们。例如，您可能想要使用资源文件中指定的图标创建一个工具按钮。</p>
<a name="usingresources"></a><div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><img src="images/designer-resources-using.png" alt="" /></td><td >
	 <b><span lang="zh-cn">使用资源</span></b><p>当使用可能在资源文件中定义的值更改属性时，Qt 
	 Designer的属性编辑器允许您指定一个资源，除了以普通方式选择源文件的选项之外。</p>
</td></tr>
<tr valign="top" class="even"><td ><img src="images/designer-resource-selector.png" alt="" /></td><td >
	<b><span lang="zh-cn">选择一个资源</span></b><p>您可以通过单击<b>Choose Resource..&#x2e;</b>来打开资源选择器。在设计过程中随时添加资源。</p>
</td></tr>
</table></div>
</div>
<!-- @@@designer-resources.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="designer-creating-mainwindows.html">在Qt设计师中创建主窗口</a>
<span class="naviSeparator">  &#9702;  
<a class="nextPage" href="designer-stylesheet.html"><span lang="zh-cn">在</span>Qt设计<span lang="zh-cn">师中使用样式表</span></a></span>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
